GPtrArray *parts;
GPtrArray *fallback_objects;
guint64 loose_compressed_size;
- guint64 max_usize_bytes;
+ guint64 min_fallback_size_bytes;
+ guint64 max_chunk_size_bytes;
} OstreeStaticDeltaBuilder;
static void
/* Check to see if this delta is maximum size */
if (current_part->objects->len > 0 &&
- current_part->payload->len + content_size > builder->max_usize_bytes)
+ current_part->payload->len + content_size > builder->max_chunk_size_bytes)
{
*current_part_val = current_part = allocate_part (builder);
}
NULL, &uncompressed_size,
cancellable, error))
goto out;
- if (uncompressed_size > builder->max_usize_bytes)
+ if (uncompressed_size > builder->min_fallback_size_bytes)
fallback = TRUE;
if (fallback)
*
* The @params argument should be an a{sv}. The following attributes
* are known:
- * - max-usize: u: Maximum size in megabytes of a delta part
+ * - min-fallback-size: u: Minimume uncompressed size in megabytes to use fallback
+ * - max-chunk-size: u: Maximum size in megabytes of a delta part
* - compression: y: Compression type: 0=none, x=lzma, g=gzip
*/
gboolean
gboolean ret = FALSE;
OstreeStaticDeltaBuilder builder = { 0, };
guint i;
- guint max_usize;
+ guint min_fallback_size;
+ guint max_chunk_size;
GVariant *metadata_source;
guint64 total_compressed_size = 0;
guint64 total_uncompressed_size = 0;
builder.parts = g_ptr_array_new_with_free_func ((GDestroyNotify)ostree_static_delta_part_builder_unref);
builder.fallback_objects = g_ptr_array_new_with_free_func ((GDestroyNotify)g_variant_unref);
- if (!g_variant_lookup (params, "max-usize", "u", &max_usize))
- max_usize = 32;
- builder.max_usize_bytes = ((guint64)max_usize) * 1000 * 1000;
+ if (!g_variant_lookup (params, "min-fallback-size", "u", &min_fallback_size))
+ min_fallback_size = 4;
+ builder.min_fallback_size_bytes = ((guint64)min_fallback_size) * 1000 * 1000;
+
+ if (!g_variant_lookup (params, "max-chunk-size", "u", &max_chunk_size))
+ max_chunk_size = 32;
+ builder.max_chunk_size_bytes = ((guint64)max_chunk_size) * 1000 * 1000;
if (!ostree_repo_load_variant (self, OSTREE_OBJECT_TYPE_COMMIT, to,
&to_commit, error))
static char *opt_to_rev;
static char **opt_key_ids;
static char *opt_gpg_homedir;
-static char *opt_max_usize;
+static char *opt_min_fallback_size;
+static char *opt_max_chunk_size;
static gboolean opt_empty;
#define BUILTINPROTO(name) static gboolean ot_static_delta_builtin_ ## name (int argc, char **argv, GCancellable *cancellable, GError **error)
{ "to", 0, 0, G_OPTION_ARG_STRING, &opt_to_rev, "Create delta to revision REV", "REV" },
{ "gpg-sign", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_key_ids, "GPG Key ID to sign the delta with", "key-id"},
{ "gpg-homedir", 0, 0, G_OPTION_ARG_STRING, &opt_gpg_homedir, "GPG Homedir to use when looking for keyrings", "homedir"},
- { "max-usize", 'u', 0, G_OPTION_ARG_STRING, &opt_max_usize, "Maximum uncompressed size in megabytes", NULL},
+ { "min-fallback-size", 0, 0, G_OPTION_ARG_STRING, &opt_min_fallback_size, "Minimum uncompressed size in megabytes for individual HTTP request", NULL},
+ { "max-chunk-size", 0, 0, G_OPTION_ARG_STRING, &opt_max_chunk_size, "Maximum size of delta chunks in megabytes", NULL},
{ NULL }
};
goto out;
parambuilder = g_variant_builder_new (G_VARIANT_TYPE ("a{sv}"));
- if (opt_max_usize)
+ if (opt_min_fallback_size)
g_variant_builder_add (parambuilder, "{sv}",
- "max-usize", g_variant_new_uint32 (g_ascii_strtoull (opt_max_usize, NULL, 10)));
+ "min-fallback-size", g_variant_new_uint32 (g_ascii_strtoull (opt_min_fallback_size, NULL, 10)));
+ if (opt_max_chunk_size)
+ g_variant_builder_add (parambuilder, "{sv}",
+ "max-chunk-size", g_variant_new_uint32 (g_ascii_strtoull (opt_max_chunk_size, NULL, 10)));
g_print ("Generating static delta:\n");
g_print (" From: %s\n", from_resolved ? from_resolved : "empty");